<template>
	<view class="myLayout sysBg">
		<view :style="{height:getNavBarHeight()+'px'}"></view>
		<view class="userInfo">
			<view class="avatar">
				<image src="https://res.vmallres.com/uomcdn/CN/cms/202504/804e81df1de441918cae2cec6347787b.jpg" mode="aspectFill"></image>
			</view>
			<view class="nick">华为M8</view>
		</view>
		
		<view class="section">
			<view class="list">
				<view class="row">
					<NavComponent leftIcon="download-filled" leftText="我的下载" rightText="100"/>
				</view>
				<view class="row">
					<NavComponent leftIcon="star-filled" leftText="我的评分" rightText="200"/>
				</view>
				<view class="row contact">
					<NavComponent leftIcon="chatboxes-filled" leftText="联系客服"/>
					<!-- #ifdef MP -->
					<button class="btncontact" open-type="contact">联系客服</button>
					<!-- #endif -->
				</view>
				
				<view class="row contact">
					<NavComponent leftIcon="phone-filled" leftText="拨打电话"/>
					<!-- #ifdef APP || MP -->
					<button class="btnTel" @click="telHandler">拨打电话</button>
					<!-- #endif -->
				</view>
			</view>
		</view>
		
		<view class="section sectionMarginTop">
			<view class="list">
				<view class="row">
					<NavComponent leftIcon="notification-filled" leftText="订阅更新"/>
				</view>
				<view class="row">
					<NavComponent leftIcon="flag-filled" leftText="常见问题"/>
				</view>
				<view class="row" @click.stop="goLogin">
					<NavComponent leftIcon="auth-filled" leftText="切换账号"/>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script setup>
	import {getNavBarHeight} from '@/utils/system';
	
	// App,各个小程序拨打电话功能
	const telHandler=()=>{
		uni.makePhoneCall({
			phoneNumber:"18551131670"
		})
	}
	
	const goLogin = ()=>{
		uni.navigateTo({
			url:"/pages/login/login"
		})
	}
</script>

<style lang="scss" scoped>
	.sectionMarginTop{
		margin-top:60rpx;
	}
	.myLayout {
		padding:30rpx;
		height: 100%;
		.userInfo{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			padding:50rpx 0;
			.avatar{
				width: 160rpx;
				height: 160rpx;
				overflow: hidden;
				border-radius: 50%;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
		.section {
			.list {
				background: #fff;
				border-radius: 10rpx;
				border:2rpx solid #f2f2f2;
				view+view {
					border-top: 2rpx solid #f2f2f2;
				}
			}
			.contact {
				position: relative;
				.btncontact,.btnTel {
					position: absolute;
					top:0;
					left:0;right:0;
					bottom:0;
					opacity: 0;
				}
				
			}
		}
	}

</style>
